package exception;

import java.util.zip.DataFormatException;

public class ThrowDemo {
    public static void main(String[] args) {
        Student zy=new Student();
            try {
                zy.setAge(1000);
            } catch (IllegalAgeException e) {
                e.printStackTrace();
            }
        System.out.println("此人年龄为："+zy.getAge()+"岁");
        /*try{
        zy.setAge(1000);
        System.out.println("此人年龄为："+zy.getAge()+"岁");
        }catch (Exception e){
            System.out.println("年龄不合法");
        }

         */



    }
}
